<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">

	$(function() {
		var residenceId = '${residenceId}';
		var orgStatus = '${shOrders.status}';
		
		//小区
		$.ajax({
			type:'post',
			url:'/residenceController/combobox',
			data:{},
			success:function(result) {
				$('#residenceId').combobox({
					data : result,
					valueField:'value',   
				    textField:'text',
				    panelHeight:'auto',
				    onSelect : function(a){
						//var residenceId=a.value;
						//getBuildingId(residenceId);//楼栋联动，得到小区的楼栋
					},
					value : '${shOrders.residenceId}'
				});

			},
			dataType:'json'
		});
		
		
		$('#form').form({
			url : '/xiyiOrderController/edit?bingType=2',
			onSubmit : function() {
				if($('#showAmount').val() != null) {
					$('#amount').val($('#showAmount').val()*100);
				}
				
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.messager.alert('提示',result.msg,'info');
					parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为resource.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				}else{
					parent.$.messager.alert('提示',result.msg,'info');
				}
			}
		});
		parent.$.messager.progress('close');

		
		
		/* if(orgStatus!='1'){
			document.getElementById('residenceId').readOnly=true;
			document.getElementById('companyId').readOnly=true;
			document.getElementById('outBizNum').readOnly=true;
			document.getElementById('name').readOnly=true;
			document.getElementById('amount').readOnly=true;
			document.getElementById('khName').readOnly=true;
			document.getElementById('khMobile').readOnly=true;
			document.getElementById('remark').readOnly=true;

		} */
		//alert(orgStatus);
		showXiyi(orgStatus);//洗衣店下拉
		
		$('#status').combobox({
			data : [{"value":1,"text":"待处理"},
			        {"value":5,"text":"已取件"},
			        {"value":7,"text":"已送洗"},
			        {"value":8,"text":"代取"},
			        {"value":2,"text":"完成"},
			        {"value":3,"text":"关闭"},
			        {"value":4,"text":"删除"},],
		    panelHeight:'auto',
		    value : '${shOrders.status}'
		});
		
	});
	
	//洗衣店下拉
	function showXiyi(orgStatus){
		$.ajax({
			type:'post',
			url:'/companyLaundryController/getCombobox',
			data:{},
			success:function(result) {
				if(orgStatus!='1'){
					$('.companyId').combobox({
						data : result,
						valueField:'value',   
					    textField:'text',
					    panelHeight:'auto',
					    editable:false,
					    value : '${shOrders.companyId}'
					});
				}else{
					$('.companyId').combobox({
						data : result,
						valueField:'value',   
					    textField:'text',
					    panelHeight:'auto',
					    value : '${shOrders.companyId}'
					});
				}
			},
			dataType:'json'
		});
	}
	
	
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: auto;">
		<form id="form" method="post">
			<input type="hidden" name="id" value="${shOrders.id }"/>
			<table class="table table-hover table-condensed">
			<tr>
					<th>所属小区</th>
					<td ><input name="residenceId" id="residenceId" class="span2 " readonly="readonly" /></td>
					<th>洗衣店</th>
					<td ><input id="companyId"  name="companyId" class="span2 companyId"  data-options="required:true"  /></td>
				</tr>
				<tr>
					<th>订单类型</th>
					<td >洗衣服务</td>
					<th>洗衣面单</th>
					<td ><input  id="outBizNum"  name="outBizNum" type="text"  value="${shOrders.outBizNum}" class="easyui-validatebox span2" data-options="required:true" ></td>
				</tr>
				<tr>
					<th>订单名称</th><!-- style="width: 375px; height: 29px;" -->
					<td ><input id="name"  name="name"  value="${shOrders.name}"  /></td>
					<th>订单费用</th>
					<td >
						<input id="showAmount"  name="showAmount"  value="${shOrders.amount/100}"  type="text" placeholder="请输入设备出厂编码" class="easyui-validatebox span2" data-options="required:true" >
						<input name="amount" id="amount" type="hidden" />
					</td>
				</tr>
				<tr>
					<th>客户名称</th><!-- style="width: 375px; height: 29px;" -->
					<td ><input id="khName"  name="khName"  value="${shHistoryAccount.name}"  /></td>
					<th>手机号码</th>
					<td ><input id="khMobile" name="khMobile"  value="${shHistoryAccount.mobile}"  type="text" placeholder="请输入角色名称" class="easyui-validatebox span2" data-options="validType:'isPhoneNumber'" required="required" ></td>
				</tr>
				<tr>
					<th>订单状态</th>
					<td >
						<input name="status" id="status" type="text" style="width: 150px"  />
						<%-- <select id="status" name="status" class="easyui-combobox" style="width: 150px;"  panelHeight=auto  data-options="required:true">
							<option value="" >--请选择--</option>
							<option value="1">待处理</option>
							<option value="5">已取件</option>
							<option value="7">已送洗</option>
							<option value="8">待取</option>
							<option value="2">完成</option>
							<option value="3">关闭</option>
							<option value="4">删除</option>
						</select> --%>
						</td>
					<th></th>
					<td ></td>
				</tr>
				
				<tr>
					<th>备注信息</th>
					<td colspan="3"><textarea name="remark" id="remark" value=""  class="span2 " style="width:90%; height: 89px;">${shOrders.remark}</textarea></td>
				</tr>
			</table>
		</form>
	</div>
</div>